//
//  LadingBillDetailCell.m
//  ReceiptDelivery
//
//  Created by 吕晶 on 2020/7/7.
//  Copyright © 2020 吕晶. All rights reserved.
//

#import "LadingBillDetailCell.h"

@interface LadingBillDetailCell ()

@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UIButton *lookBtn;
@property (nonatomic, strong) UILabel *noTitleLab;
@property (nonatomic, strong) UILabel *noLab;
@property (nonatomic, strong) UILabel *xiaDanTimeTitleLab;
@property (nonatomic, strong) UILabel *xiaDanTimeLab;
//@property (nonatomic, strong) UIButton *fuZhiBtn;
@property (nonatomic, strong) UILabel *chengYunTitleLab;
@property (nonatomic, strong) UILabel *chengYunLab;
@property (nonatomic, strong) UILabel *heTongNOTitleLab;
@property (nonatomic, strong) UILabel *heTongNOLab;
@property (nonatomic, strong) UILabel *line1;

@property (nonatomic, strong) UIImageView *tiImgView;
@property (nonatomic, strong) UILabel *tiNameLab;
@property (nonatomic, strong) UILabel *tiAddressLab;
@property (nonatomic, strong) UILabel *tiCompanyLab;
@property (nonatomic, strong) UILabel *desc1Lab;
@property (nonatomic, strong) UILabel *marginLine;
@property (nonatomic, strong) UIImageView *shouImgView;
@property (nonatomic, strong) UILabel *shouNameLab;
@property (nonatomic, strong) UILabel *shouAddressLab;
@property (nonatomic, strong) UILabel *shouCompanyLab;
@property (nonatomic, strong) UILabel *desc2Lab;
@property (nonatomic, strong) UILabel *marginLine2;
@property (nonatomic, strong) UILabel *linkLine;

@property (nonatomic, strong) UILabel *linkOrderTitleLab;
@property (nonatomic, strong) UILabel *linkOrderLab;
@property (nonatomic, strong) UILabel *yuanShiTitleLab;
@property (nonatomic, strong) UILabel *yuanShiLab;

@property (nonatomic, strong) UILabel *timeTitleLab;
@property (nonatomic, strong) UILabel *beignTimeLab;
@property (nonatomic, strong) UILabel *endTimeLab;
@property (nonatomic, strong) UIView *beginDotView;
@property (nonatomic, strong) UIView *endDotView;
@property (nonatomic, strong) UILabel *timeLine;

@property (nonatomic, strong) UILabel *dateTitleLab;
@property (nonatomic, strong) UILabel *dateLab;
@property (nonatomic, strong) UILabel *fuWuTitleLab;
@property (nonatomic, strong) UILabel *fuWuLab;
@property (nonatomic, strong) UILabel *YunShuTitleLab;
@property (nonatomic, strong) UILabel *YunShuLab;
@property (nonatomic, strong) UILabel *carTitleLab;
@property (nonatomic, strong) UILabel *carLab;
@property (nonatomic, strong) UILabel *weightTitleLab;
@property (nonatomic, strong) UILabel *weightLab;
@property (nonatomic, strong) UILabel *tiJiTitleLab;
@property (nonatomic, strong) UILabel *tiJiLab;
@property (nonatomic, strong) UILabel *baoXianTitleLab;
@property (nonatomic, strong) UILabel *baoXianLab;
@property (nonatomic, strong) UILabel *fileTitleLab;
@property (nonatomic, strong) UILabel *fileLab;
@property (nonatomic, strong) UILabel *remarkTitleLab;
@property (nonatomic, strong) UILabel *remarkLab;

@end

@implementation LadingBillDetailCell

+ (instancetype)LadingBillDetailCellWithTableView:(UITableView *)tableView {
    static NSString *cellID = @"LadingBillDetailCell";
    LadingBillDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[LadingBillDetailCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = Color_backgroundColor;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.bgView = [UIView new];
        self.bgView.backgroundColor = HexColor(0xffffff);
        self.bgView.layer.masksToBounds = YES;
        self.bgView.layer.cornerRadius = 6;
        [self.contentView addSubview:self.bgView];
        
        self.lookBtn = [UIButton new];
        [self.lookBtn setTitle:@"查看货物清单" forState:0];
        [self.lookBtn setTitleColor:Color_ThemeColor forState:0];
        self.lookBtn.titleLabel.font = BoldFontOfSize(16);
        [self.lookBtn setImage:[UIImage imageNamed:@"icon_form"] forState:0];
        [self.lookBtn addTarget:self action:@selector(lookClick) forControlEvents:UIControlEventTouchUpInside];
        [self.lookBtn setBackgroundColor:HexColor(0xffffff)];
        self.lookBtn.layer.masksToBounds = YES;
        self.lookBtn.layer.cornerRadius = 6;
        [self.contentView addSubview:self.lookBtn];
        
        self.noTitleLab = [UILabel new];
        self.noTitleLab.textColor = HexColor(0x9C9DB3);
        self.noTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.noTitleLab];
        
        self.noLab = [UILabel new];
        self.noLab.textColor = HexColor(0x2B2C44);
        self.noLab.font = BoldFontOfSize(14);
        self.noLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.noLab];
        
//        self.fuZhiBtn = [UIButton new];
//        [self.bgView addSubview:self.fuZhiBtn];
        
        self.xiaDanTimeTitleLab = [UILabel new];
        self.xiaDanTimeTitleLab.textColor = HexColor(0x9C9DB3);
        self.xiaDanTimeTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.xiaDanTimeTitleLab];
        
        self.xiaDanTimeLab = [UILabel new];
        self.xiaDanTimeLab.textColor = HexColor(0x2B2C44);
        self.xiaDanTimeLab.font = [UIFont systemFontOfSize:14];
        self.xiaDanTimeLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.xiaDanTimeLab];
        
        self.chengYunTitleLab = [UILabel new];
        self.chengYunTitleLab.textColor = HexColor(0x9C9DB3);
        self.chengYunTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.chengYunTitleLab];
        
        self.chengYunLab = [UILabel new];
        self.chengYunLab.textColor = HexColor(0x2B2C44);
        self.chengYunLab.font = [UIFont systemFontOfSize:14];
        self.chengYunLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.chengYunLab];
        
        self.heTongNOTitleLab = [UILabel new];
        self.heTongNOTitleLab.textColor = HexColor(0x9C9DB3);
        self.heTongNOTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.heTongNOTitleLab];
        
        self.heTongNOLab = [UILabel new];
        self.heTongNOLab.textColor = HexColor(0x2B2C44);
        self.heTongNOLab.font = [UIFont systemFontOfSize:14];
        self.heTongNOLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.heTongNOLab];
        
        self.line1 = [UILabel new];
        self.line1.backgroundColor = HexColor(0xF2F2F5);
        [self.bgView addSubview:self.line1];
        
        self.tiImgView = [UIImageView new];
        self.tiImgView.image = [UIImage imageNamed:@"icon_add_ti"];
        [self.bgView addSubview:self.tiImgView];
        
        self.tiNameLab = [UILabel new];
        self.tiNameLab.textColor = HexColor(0x2B2C44);
        self.tiNameLab.font = BoldFontOfSize(16);
        [self.bgView addSubview:self.tiNameLab];
        
        self.tiAddressLab = [UILabel new];
        self.tiAddressLab.textColor = HexColor(0x2B2C44);
        self.tiAddressLab.font = [UIFont systemFontOfSize:14];
        self.tiAddressLab.numberOfLines = 0;
        [self.bgView addSubview:self.tiAddressLab];
        
        self.tiCompanyLab = [UILabel new];
        self.tiCompanyLab.textColor = HexColor(0x2B2C44);
        self.tiCompanyLab.font = [UIFont systemFontOfSize:14];
        self.tiCompanyLab.numberOfLines = 0;
        [self.bgView addSubview:self.tiCompanyLab];
        
        self.marginLine = [UILabel new];
        self.marginLine.backgroundColor = HexColor(0xF2F2F5);
        [self.bgView addSubview:self.marginLine];
        
        self.shouImgView = [UIImageView new];
        self.shouImgView.image = [UIImage imageNamed:@"icon_add_shou"];
        [self.bgView addSubview:self.shouImgView];
        
        self.shouNameLab = [UILabel new];
        self.shouNameLab.textColor = HexColor(0x2B2C44);
        self.shouNameLab.font = BoldFontOfSize(16);
        [self.bgView addSubview:self.shouNameLab];
        
        self.shouAddressLab = [UILabel new];
        self.shouAddressLab.textColor = HexColor(0x2B2C44);
        self.shouAddressLab.font = [UIFont systemFontOfSize:14];
        self.shouAddressLab.numberOfLines = 0;
        [self.bgView addSubview:self.shouAddressLab];
        
        self.shouCompanyLab = [UILabel new];
        self.shouCompanyLab.textColor = HexColor(0x2B2C44);
        self.shouCompanyLab.font = [UIFont systemFontOfSize:14];
        self.shouCompanyLab.numberOfLines = 0;
        [self.bgView addSubview:self.shouCompanyLab];
        
        self.marginLine2 = [UILabel new];
        self.marginLine2.backgroundColor = HexColor(0xF2F2F5);
        [self.bgView addSubview:self.marginLine2];
        
        self.linkLine = [UILabel new];
        self.linkLine.backgroundColor = HexColorA(0x3D68EB, 0.2);
        [self.bgView addSubview:self.linkLine];
        
        
        self.linkOrderTitleLab = [UILabel new];
        self.linkOrderTitleLab.textColor = HexColor(0x9C9DB3);
        self.linkOrderTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.linkOrderTitleLab];
        
        self.linkOrderLab = [UILabel new];
        self.linkOrderLab.textColor = HexColor(0x2B2C44);
        self.linkOrderLab.font = [UIFont systemFontOfSize:14];
        self.linkOrderLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.linkOrderLab];
        
        self.yuanShiTitleLab = [UILabel new];
        self.yuanShiTitleLab.textColor = HexColor(0x9C9DB3);
        self.yuanShiTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.yuanShiTitleLab];
        
        self.yuanShiLab = [UILabel new];
        self.yuanShiLab.textColor = HexColor(0x2B2C44);
        self.yuanShiLab.font = [UIFont systemFontOfSize:14];
        self.yuanShiLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.yuanShiLab];
        
        
        self.timeTitleLab = [UILabel new];
        self.timeTitleLab.textColor = HexColor(0x9C9DB3);
        self.timeTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.timeTitleLab];
        
        self.beignTimeLab = [UILabel new];
        self.beignTimeLab.textColor = HexColor(0x2B2C44);
        self.beignTimeLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.beignTimeLab];
        
        self.endTimeLab = [UILabel new];
        self.endTimeLab.textColor = HexColor(0x2B2C44);
        self.endTimeLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.endTimeLab];
        
        self.beginDotView = [UIView new];
        self.beginDotView.backgroundColor = HexColor(0x2B2C44);
        [self.bgView addSubview:self.beginDotView];
        
        self.endDotView = [UIView new];
        self.endDotView.backgroundColor = HexColor(0x2B2C44);
        [self.bgView addSubview:self.endDotView];
        
        self.timeLine = [UILabel new];
        self.timeLine.backgroundColor = HexColor(0xBDBED9);
        [self.bgView addSubview:self.timeLine];
        
        self.dateTitleLab = [UILabel new];
        self.dateTitleLab.textColor = HexColor(0x9C9DB3);
        self.dateTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.dateTitleLab];
        
        self.dateLab = [UILabel new];
        self.dateLab.textColor = HexColor(0x2B2C44);
        self.dateLab.font = [UIFont systemFontOfSize:14];
        self.dateLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.dateLab];
        
        self.fuWuTitleLab = [UILabel new];
        self.fuWuTitleLab.textColor = HexColor(0x9C9DB3);
        self.fuWuTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.fuWuTitleLab];
        
        self.fuWuLab = [UILabel new];
        self.fuWuLab.textColor = HexColor(0x2B2C44);
        self.fuWuLab.font = [UIFont systemFontOfSize:14];
        self.fuWuLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.fuWuLab];
        
        self.YunShuTitleLab = [UILabel new];
        self.YunShuTitleLab.textColor = HexColor(0x9C9DB3);
        self.YunShuTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.YunShuTitleLab];
        
        self.YunShuLab = [UILabel new];
        self.YunShuLab.textColor = HexColor(0x2B2C44);
        self.YunShuLab.font = [UIFont systemFontOfSize:14];
        self.YunShuLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.YunShuLab];
        
        self.carTitleLab = [UILabel new];
        self.carTitleLab.textColor = HexColor(0x9C9DB3);
        self.carTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.carTitleLab];
        
        self.carLab = [UILabel new];
        self.carLab.textColor = HexColor(0x2B2C44);
        self.carLab.font = [UIFont systemFontOfSize:14];
        self.carLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.carLab];
        
        self.weightTitleLab = [UILabel new];
        self.weightTitleLab.textColor = HexColor(0x9C9DB3);
        self.weightTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.weightTitleLab];
        
        self.weightLab = [UILabel new];
        self.weightLab.textColor = HexColor(0x2B2C44);
        self.weightLab.font = [UIFont systemFontOfSize:14];
        self.weightLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.weightLab];
        
        self.tiJiTitleLab = [UILabel new];
        self.tiJiTitleLab.textColor = HexColor(0x9C9DB3);
        self.tiJiTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.tiJiTitleLab];
        
        self.tiJiLab = [UILabel new];
        self.tiJiLab.textColor = HexColor(0x2B2C44);
        self.tiJiLab.font = [UIFont systemFontOfSize:14];
        self.tiJiLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.tiJiLab];
        
        self.baoXianTitleLab = [UILabel new];
        self.baoXianTitleLab.textColor = HexColor(0x9C9DB3);
        self.baoXianTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.baoXianTitleLab];
        
        self.baoXianLab = [UILabel new];
        self.baoXianLab.textColor = HexColor(0x2B2C44);
        self.baoXianLab.font = [UIFont systemFontOfSize:14];
        self.baoXianLab.textAlignment = NSTextAlignmentRight;
        [self.bgView addSubview:self.baoXianLab];
        
        self.fileTitleLab = [UILabel new];
        self.fileTitleLab.textColor = HexColor(0x9C9DB3);
        self.fileTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.fileTitleLab];
        
        self.fileLab = [UILabel new];
        self.fileLab.textColor = HexColor(0x2B2C44);
        self.fileLab.font = [UIFont systemFontOfSize:14];
        self.fileLab.textAlignment = NSTextAlignmentRight;
        self.fileLab.numberOfLines = 0;
        [self.bgView addSubview:self.fileLab];
        
        self.remarkTitleLab = [UILabel new];
        self.remarkTitleLab.textColor = HexColor(0x9C9DB3);
        self.remarkTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.remarkTitleLab];
        
        self.remarkLab = [UILabel new];
        self.remarkLab.textColor = HexColor(0x2B2C44);
        self.remarkLab.font = [UIFont systemFontOfSize:14];
        self.remarkLab.textAlignment = NSTextAlignmentRight;
        self.remarkLab.numberOfLines = 0;
        [self.bgView addSubview:self.remarkLab];
        
    }
    return self;
}

- (void)lookClick {
    if (self.lookBlock) {
        self.lookBlock();
    }
}

-(void)setModel:(LadingBillMainModel *)model {
    _model = model;
    [self configUI];
}

- (void)configUI {
    self.bgView.nim_left = 15;
    self.bgView.nim_top = 10;
    self.bgView.nim_width = ScreenW - 2 * self.bgView.nim_left;
    
    self.noTitleLab.text = @"提货单号：";
    self.noTitleLab.nim_left = 15;
    self.noTitleLab.nim_top = 20;
    [self.noTitleLab sizeToFit];
    
    self.noLab.text = self.model.serial_num;
    [self.noLab sizeToFit];
    self.noLab.nim_left = self.bgView.nim_width - 15 - self.noLab.nim_width;
    self.noLab.nim_centerY = self.noTitleLab.nim_centerY;
    
//    self.fuZhiBtn.nim_left = self.noLab.nim_right + 6;
//    self.fuZhiBtn.nim_width = 18;
//    self.fuZhiBtn.nim_height = 18;
//    self.fuZhiBtn.nim_centerY = self.noLab.nim_centerY;
//    [self.fuZhiBtn setImage:[UIImage imageNamed:@"icon_ladingbill_erweima"] forState:0];
    
    self.xiaDanTimeTitleLab.text = @"下单时间：";
    self.xiaDanTimeTitleLab.nim_left = 15;
    self.xiaDanTimeTitleLab.nim_top = self.noTitleLab.nim_bottom + 15;
    [self.xiaDanTimeTitleLab sizeToFit];
    
    self.xiaDanTimeLab.text = self.model.order_time;
    [self.xiaDanTimeLab sizeToFit];
    self.xiaDanTimeLab.nim_left = self.xiaDanTimeTitleLab.nim_right;
    self.xiaDanTimeLab.nim_width = self.bgView.nim_width - 15 - self.xiaDanTimeLab.nim_left;
    self.xiaDanTimeLab.nim_centerY = self.xiaDanTimeTitleLab.nim_centerY;
    
    self.chengYunTitleLab.text = @"承运方：";
    self.chengYunTitleLab.nim_left = 15;
    self.chengYunTitleLab.nim_top = self.xiaDanTimeTitleLab.nim_bottom + 15;
    [self.chengYunTitleLab sizeToFit];
    
    self.chengYunLab.text = self.model.name;
    [self.chengYunLab sizeToFit];
    self.chengYunLab.nim_left = self.chengYunTitleLab.nim_right;
    self.chengYunLab.nim_width = self.bgView.nim_width - 15 - self.chengYunLab.nim_left;
    self.chengYunLab.nim_centerY = self.chengYunTitleLab.nim_centerY;
    
    self.heTongNOTitleLab.text = @"托运合同：";
    self.heTongNOTitleLab.nim_left = 15;
    self.heTongNOTitleLab.nim_top = self.chengYunTitleLab.nim_bottom + 15;
    [self.heTongNOTitleLab sizeToFit];
    
    self.heTongNOLab.text = self.model.constract_sn;
    [self.heTongNOLab sizeToFit];
    self.heTongNOLab.nim_left = self.heTongNOTitleLab.nim_right;
    self.heTongNOLab.nim_width = self.bgView.nim_width - 15 - self.heTongNOLab.nim_left;
    self.heTongNOLab.nim_centerY = self.heTongNOTitleLab.nim_centerY;
    
    self.line1.frame = CGRectMake(0, self.heTongNOTitleLab.nim_bottom + 20, self.bgView.nim_width, 2);
    
    self.tiNameLab.text = [NSString stringWithFormat:@"%@ %@",self.model.pickup_address.liaison,self.model.pickup_address.tel];
    [self.tiNameLab sizeToFit];
    self.tiNameLab.nim_left = 59;
    self.tiNameLab.nim_top = 15 + self.line1.nim_bottom;
    self.tiNameLab.nim_width = self.bgView.nim_width - 10 - self.tiNameLab.nim_left;
    
    self.tiAddressLab.text = self.model.pickup_address.address;
    self.tiAddressLab.nim_left = self.tiNameLab.nim_left;
    self.tiAddressLab.nim_top = self.tiNameLab.nim_bottom + 10;
    self.tiAddressLab.nim_width = self.bgView.nim_width - 10 - self.tiNameLab.nim_left;
    [self.tiAddressLab sizeToFit];
    self.tiAddressLab.nim_width = self.bgView.nim_width - 10 - self.tiNameLab.nim_left;
    
    self.tiCompanyLab.text = self.model.pickup_address.name;
    self.tiCompanyLab.nim_left = self.tiAddressLab.nim_left;
    self.tiCompanyLab.nim_top = self.tiAddressLab.nim_bottom + 5;
    self.tiCompanyLab.nim_width = self.bgView.nim_width - 10 - self.tiNameLab.nim_left;
    [self.tiCompanyLab sizeToFit];
    self.tiCompanyLab.nim_width = self.bgView.nim_width - 10 - self.tiNameLab.nim_left;
    
    self.marginLine.nim_left = self.tiNameLab.nim_left - 5;
    self.marginLine.nim_top = self.tiCompanyLab.nim_bottom + 10;
    self.marginLine.nim_width = self.bgView.nim_width - self.marginLine.nim_left;
    self.marginLine.nim_height = 1;
    
    self.tiImgView.nim_width = 22;
    self.tiImgView.nim_height = 22;
    self.tiImgView.nim_left = 20;
    self.tiImgView.nim_top = (self.marginLine.nim_top - self.line1.nim_bottom - self.tiImgView.nim_width) * 0.5 + self.line1.nim_bottom;
    
    self.shouNameLab.text = [NSString stringWithFormat:@"%@ %@",self.model.collect_address.liaison,self.model.collect_address.tel];
    [self.shouNameLab sizeToFit];
    self.shouNameLab.nim_left = 59;
    self.shouNameLab.nim_top = 10 + self.marginLine.nim_bottom;
    self.shouNameLab.nim_width = self.bgView.nim_width - 10 - self.shouNameLab.nim_left;
    
    self.shouAddressLab.text = self.model.collect_address.address;
    self.shouAddressLab.nim_left = self.shouNameLab.nim_left;
    self.shouAddressLab.nim_top = self.shouNameLab.nim_bottom + 10;
    self.shouAddressLab.nim_width = self.bgView.nim_width - 10 - self.shouNameLab.nim_left;
    [self.shouAddressLab sizeToFit];
    self.shouAddressLab.nim_width = self.bgView.nim_width - 10 - self.shouNameLab.nim_left;
    
    self.shouCompanyLab.text = self.model.collect_address.name;
    self.shouCompanyLab.nim_left = self.shouAddressLab.nim_left;
    self.shouCompanyLab.nim_top = self.shouAddressLab.nim_bottom + 5;
    self.shouCompanyLab.nim_width = self.bgView.nim_width - 10 - self.shouNameLab.nim_left;
    [self.shouCompanyLab sizeToFit];
    self.shouCompanyLab.nim_width = self.bgView.nim_width - 10 - self.shouNameLab.nim_left;
    
    self.marginLine2.nim_left = 0;
    self.marginLine2.nim_top = self.shouCompanyLab.nim_bottom + 15;
    self.marginLine2.nim_width = self.bgView.nim_width;
    self.marginLine2.nim_height = 2;

    self.shouImgView.nim_width = 22;
    self.shouImgView.nim_height = 22;
    self.shouImgView.nim_left = 20;
    self.shouImgView.nim_top = self.marginLine2.nim_top - (self.marginLine2.nim_top - self.marginLine.nim_bottom - self.shouImgView.nim_height) * 0.5 - self.shouImgView.nim_height;
    
    self.linkLine.nim_width = 2;
    self.linkLine.nim_top = self.tiImgView.nim_bottom + 3;
    self.linkLine.nim_height = self.shouImgView.nim_top - 3 - self.linkLine.nim_top;
    self.linkLine.nim_centerX = self.tiImgView.nim_centerX;
    
    self.linkOrderTitleLab.text = @"关联订单：";
    self.linkOrderTitleLab.nim_left = 15;
    self.linkOrderTitleLab.nim_top = 20 + self.marginLine2.nim_bottom;
    [self.linkOrderTitleLab sizeToFit];
    
    self.linkOrderLab.text = self.model.aorder;
    [self.linkOrderLab sizeToFit];
    self.linkOrderLab.nim_left = self.bgView.nim_width - 15 - self.linkOrderLab.nim_width;
    self.linkOrderLab.nim_centerY = self.linkOrderTitleLab.nim_centerY;
    
    self.yuanShiTitleLab.text = @"原始单号：";
    self.yuanShiTitleLab.nim_left = 15;
    self.yuanShiTitleLab.nim_top = 10 + self.linkOrderTitleLab.nim_bottom;
    [self.yuanShiTitleLab sizeToFit];
    
    self.yuanShiLab.text = self.model.ynum;
    [self.yuanShiLab sizeToFit];
    self.yuanShiLab.nim_left = self.bgView.nim_width - 15 - self.yuanShiLab.nim_width;
    self.yuanShiLab.nim_centerY = self.yuanShiTitleLab.nim_centerY;
    
    
    self.timeTitleLab.text = @"提货时间：";
    self.timeTitleLab.nim_left = 15;
    self.timeTitleLab.nim_top = 10 + self.yuanShiTitleLab.nim_bottom;
    [self.timeTitleLab sizeToFit];
    
    self.beignTimeLab.text = self.model.startTime;
    [self.beignTimeLab sizeToFit];
    self.beignTimeLab.nim_left = self.bgView.nim_width - 15 - self.beignTimeLab.nim_width;
    self.beignTimeLab.nim_centerY = self.timeTitleLab.nim_centerY;
    
    self.endTimeLab.text = self.model.endTime;
    [self.endTimeLab sizeToFit];
    self.endTimeLab.nim_left = self.bgView.nim_width - 15 - self.endTimeLab.nim_width;
    self.endTimeLab.nim_top = self.beignTimeLab.nim_bottom + 10;
    
    self.beginDotView.nim_width = 4;
    self.beginDotView.nim_height = 4;
    self.beginDotView.nim_left = (self.beignTimeLab.nim_width > self.endTimeLab.nim_width ? self.beignTimeLab.nim_left : self.endTimeLab.nim_left) - 10 - self.beginDotView.nim_width;
    self.beginDotView.nim_centerY = self.beignTimeLab.nim_centerY;
    
    self.endDotView.nim_width = 4;
    self.endDotView.nim_height = 4;
    self.endDotView.nim_left = self.beginDotView.nim_left;
    self.endDotView.nim_centerY = self.endTimeLab.nim_centerY;
    
    self.timeLine.nim_width = 2;
    self.timeLine.nim_height = self.endDotView.nim_top - self.beginDotView.nim_bottom - 4;
    self.timeLine.nim_centerX = self.beginDotView.nim_centerX;
    self.timeLine.nim_top = self.beginDotView.nim_bottom + 2;
    
    self.dateTitleLab.nim_left = self.timeTitleLab.nim_left;
    self.dateTitleLab.nim_top = self.endTimeLab.nim_bottom + 15;
    self.dateTitleLab.text = @"要求到达时间：";
    [self.dateTitleLab sizeToFit];
    
    self.dateLab.nim_left = self.dateTitleLab.nim_right;
    self.dateLab.text = self.model.arrivalTime;
    [self.dateLab sizeToFit];
    self.dateLab.nim_centerY = self.dateTitleLab.nim_centerY;
    self.dateLab.nim_width = self.bgView.nim_width - 15 - self.dateLab.nim_left;
    
    self.fuWuTitleLab.nim_left = self.timeTitleLab.nim_left;
    self.fuWuTitleLab.nim_top = self.dateTitleLab.nim_bottom + 15;
    self.fuWuTitleLab.text = @"服务方式：";
    [self.fuWuTitleLab sizeToFit];
    
    self.fuWuLab.nim_left = self.fuWuTitleLab.nim_right;
    self.fuWuLab.text = self.model.delivery;
    [self.fuWuLab sizeToFit];
    self.fuWuLab.nim_centerY = self.fuWuTitleLab.nim_centerY;
    self.fuWuLab.nim_width = self.bgView.nim_width - 15 - self.fuWuLab.nim_left;
    
    self.YunShuTitleLab.nim_left = self.timeTitleLab.nim_left;
    self.YunShuTitleLab.nim_top = self.fuWuTitleLab.nim_bottom + 15;
    self.YunShuTitleLab.text = @"运输时效：";
    [self.YunShuTitleLab sizeToFit];
    
    self.YunShuLab.nim_left = self.YunShuTitleLab.nim_right;
    self.YunShuLab.text = self.model.tsTime;
    [self.YunShuLab sizeToFit];
    self.YunShuLab.nim_centerY = self.YunShuTitleLab.nim_centerY;
    self.YunShuLab.nim_width = self.bgView.nim_width - 15 - self.YunShuLab.nim_left;
    
    self.carTitleLab.nim_left = self.timeTitleLab.nim_left;
    self.carTitleLab.nim_top = self.YunShuTitleLab.nim_bottom + 15;
    self.carTitleLab.text = @"车辆要求：";
    [self.carTitleLab sizeToFit];
    
    self.carLab.nim_left = self.fuWuTitleLab.nim_right;
    self.carLab.text = self.model.needCar;
    [self.carLab sizeToFit];
    self.carLab.nim_centerY = self.carTitleLab.nim_centerY;
    self.carLab.nim_width = self.bgView.nim_width - 15 - self.carLab.nim_left;
    
    self.weightTitleLab.nim_left = self.timeTitleLab.nim_left;
    self.weightTitleLab.nim_top = self.carTitleLab.nim_bottom + 15;
    self.weightTitleLab.text = @"总重量(kg)：";
    [self.weightTitleLab sizeToFit];
    
    self.weightLab.nim_left = self.fuWuTitleLab.nim_right;
    self.weightLab.text = self.model.allWeight;
    [self.weightLab sizeToFit];
    self.weightLab.nim_centerY = self.weightTitleLab.nim_centerY;
    self.weightLab.nim_width = self.bgView.nim_width - 15 - self.weightLab.nim_left;
    
    self.tiJiTitleLab.nim_left = self.timeTitleLab.nim_left;
    self.tiJiTitleLab.nim_top = self.weightTitleLab.nim_bottom + 15;
    self.tiJiTitleLab.text = @"总体积(m³)：";
    [self.tiJiTitleLab sizeToFit];
    
    self.tiJiLab.nim_left = self.fuWuTitleLab.nim_right;
    self.tiJiLab.text = self.model.allVolume;
    [self.tiJiLab sizeToFit];
    self.tiJiLab.nim_centerY = self.tiJiTitleLab.nim_centerY;
    self.tiJiLab.nim_width = self.bgView.nim_width - 15 - self.tiJiLab.nim_left;
    
    self.baoXianTitleLab.nim_left = self.timeTitleLab.nim_left;
    self.baoXianTitleLab.nim_top = self.tiJiTitleLab.nim_bottom + 15;
    self.baoXianTitleLab.text = @"保险声明价值(元)：";
    [self.baoXianTitleLab sizeToFit];
    
    self.baoXianLab.nim_left = self.fuWuTitleLab.nim_right;
    self.baoXianLab.text = self.model.price;
    [self.baoXianLab sizeToFit];
    self.baoXianLab.nim_centerY = self.baoXianTitleLab.nim_centerY;
    self.baoXianLab.nim_width = self.bgView.nim_width - 15 - self.baoXianLab.nim_left;
    
    self.fileTitleLab.nim_left = self.timeTitleLab.nim_left;
    self.fileTitleLab.nim_top = self.baoXianTitleLab.nim_bottom + 15;
    self.fileTitleLab.text = @"随附文件：";
    [self.fileTitleLab sizeToFit];
    
    self.fileLab.nim_left = self.fileTitleLab.nim_right + 10;
    self.fileLab.nim_top = self.fileTitleLab.nim_top;
    self.fileLab.nim_width = self.bgView.nim_width - 15 - self.fileLab.nim_left;
    self.fileLab.text = self.model.fileInfo;
    [self.fileLab sizeToFit];
    self.fileLab.nim_width = self.bgView.nim_width - 15 - self.fileLab.nim_left;
    
    self.remarkTitleLab.nim_left = self.timeTitleLab.nim_left;
    self.remarkTitleLab.nim_top = (self.model.fileInfo.length ? self.fileLab.nim_bottom : self.fileTitleLab.nim_bottom) + 15;
    self.remarkTitleLab.text = @"备注：";
    [self.remarkTitleLab sizeToFit];
    
    self.remarkLab.nim_left = self.remarkTitleLab.nim_right + 10;
    self.remarkLab.nim_top = self.remarkTitleLab.nim_top;
    self.remarkLab.nim_width = self.bgView.nim_width - 15 - self.remarkLab.nim_left;
    self.remarkLab.text = self.model.remarks;
    [self.remarkLab sizeToFit];
    self.remarkLab.nim_width = self.bgView.nim_width - 15 - self.remarkLab.nim_left;
    
    self.bgView.nim_height = (self.model.remarks.length ? self.remarkLab.nim_bottom : self.remarkTitleLab.nim_bottom) + 20;
    
    self.lookBtn.frame = CGRectMake(self.bgView.nim_left, self.bgView.nim_bottom + 10, self.bgView.nim_width, 50);
    
    self.height = self.lookBtn.nim_bottom + 10;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
